home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / MorphOS / Epic4_mos / share / epic / help / 7_docs / Patterns < prev    next >
Encoding:
Text File  |  2002-10-28  |  1.2 KB  |  32 lines

  1. Pattern Matching                                                            
  2.  
  3. Literally, any string is a pattern.  In general, though, a pattern is a
  4. string intended to match, or be matched by, one or more other strings.  The
  5. pattern will usually contain one or more wildcards, but it doesn't need to.
  6.  
  7. The following wildcard characters are supported:
  8.  
  9.    *  matches zero or more characters
  10.    %  matches zero or more characters, except spaces
  11.    ?  matches exactly one character
  12.    
  13. Assuming we have a variable $foo set to "hello there":
  14.  
  15.    hello*                            /* pattern matches */
  16.    hello%                            /* pattern does not match */
  17.    hello%?%                          /* pattern matches */
  18.    h?llo?th?r?                       /* pattern matches */
  19.  
  20. Patterns may also contain multiple "branches".  Each branch is tested when
  21. a match attempt is made.  Branches are formed with the \\[ \\] construct.
  22. For example:
  23.  
  24.    \\[foo bar\\]blah                 /* matches "fooblah" and "barblah" */
  25.  
  26. The branching construct may be used anywhere that wildcards are used,
  27. including the various pattern matching functions, and in hook events.
  28.  
  29. See Also:
  30.    Expressions(7); match(6); on(4); pattern(6); rmatch(6); rpattern(6)
  31.  
  32.